<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="/struts-tags"  prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>添加节点流转</title>
		<link href="css/table.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/openwindow.js"></script>
		<script type="text/javascript">
		
 function savetransition(){
		var checks = $("input[name='ids']");
		var flag=false;
		var status=$("#status").val();
		for(var i=0;i<checks.length;i++){
			if(checks[i].checked){
				flag=true;
				break;
			}
		}
		if(!flag){
			alert("请添加后置节点事件");
			return;
		}
		$.post("saveNodeTransitionSet.action",$("form").serialize(),function(data){
					if(data=='success'){
						alert("添加成功");
						window.close();
						window.opener.location.href="flowNodeManager.action?flowId="+${flowId};
					}else{
						alert("添加失败！");
					}
				});
	}
			
		</script>
	</head>
	<body>
		<table align="center" border="0" cellpadding="0" cellspacing="0"
			width="98%">
			<tbody>
				<tr>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
					<td style="background: url('image/wsoa_window_002.gif');">
						<table border="0" cellpadding="0" cellspacing="0">
							<tbody>
								<tr>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"
										width="10">
										<img src="image/center_19.gif">
									</td>
									<td align="center"
										style="background: url('image/wsoa_window_002.gif');"></td>
									<td></td>
								</tr>
							</tbody>
						</table>
					</td>
					<td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
				</tr>
				<tr>
					<td style="background: url('image/wsoa_window_010.gif');" width="1">
						&nbsp;
					</td>
					<td>
					
						<form name="saveTaskFrom" id="saveTaskFrom" method="post" action="">
							<input type="hidden" name="flowId" value="${flowId}">
							<input type="hidden" name="nodeId" value="${nodeId}">
							<span class="font12"> </span>
							<table style="width: 99%;" align="center">
								<tbody>
									<tr>
										<td>
											<table style="width: 100%;" class="table5 bgcolor5"
												align="center">
												<tbody>
														<tr>
														<td class="table5" width="120px">
															节点名称
														</td>
														<td  class="table5" colspan="3">
															&nbsp;
															${node.name}
														</td>
													</tr>
													<tr>
														<td class="table5" width="120px">
															节点状态
														</td>
														<td  class="table5" colspan="3">
															&nbsp;
															<s:select id="nodestatus" disabled="true" cssStyle="width:30%" list="#{'0':'开始节点','1':'任务节点'}" name="node.status" value="node.status" theme="simple"></s:select>
														</td>
													</tr>
													
													<tr>
														<td class="table5">
															前置节点
														</td>
														<td class="table5">
														<c:forEach items="${frontNotes}" var="front">
															<div id="transactor">
															${front.name}
															</div>
														</c:forEach>
														</td>
													</tr>
													<tr>
														<td class="table5">
															后置节点
														</td>
														<td class="table5">
															<c:forEach items="${chosenBackNode}" var="chosen">
															<div id="transactor">
															${chosen.name}
															</div>
															</c:forEach>
														</td>
														
													</tr>
													<tr>
														<td class="table5">
															后置节点选择
														</td>
														<td class="table5">
															<input type="checkbox" name="ids" value="0">结束
															<c:forEach items="${backNotes}" var="back">
															<div id="transactor">
														    <input type="checkbox" name="ids" value="${back.id}">
															${back.name}
															</div>
															</c:forEach>
														</td>
													</tr>
												</tbody>
											</table>
										</td>
									</tr>
								</tbody>
							</table>
							<table style="width: 99%;" align="center">
								<tbody>
									<tr>
										<td align="center">
											<span id="errorId"></span>
										</td>
									</tr>
									<tr>
										<td align="center">
											<c:if test="${node.status!=2}">
												<input accesskey="t" value="提交" style="background: url('image/button_02.gif');" onClick="savetransition();" class="button_02" type="button">
											</c:if>
											<input class="button_02" value="取消" accesskey="c" style="background: url('image/button_02.gif');" onClick="window.close();" type="button">
										</td>
									</tr>
								</tbody>
							</table>
						</form>
					</td>
					<td style="background: url('image/wsoa_window_006.gif');" width="1">
						&nbsp;
					</td>
				</tr>
				<tr>
					<td height="1" width="1">
						<img src="image/wsoa_window_009.gif" height="16" width="14">
					</td>
					<td style="background: url('image/wsoa_window_008.gif');"
						height="1"></td>
					<td height="1" width="1">
						<img src="image/wsoa_window_007.gif" height="16" width="12">
					</td>
				</tr>
			</tbody>
		</table>
	</body>
</html>